﻿Imports Servicios
Imports System.IO
Imports Utilidades
Imports Excepciones

Public Class frmRestore
    Protected Overrides Sub PreLoad()
        Me.Icon = Icon.FromHandle(Global.SIPRO.My.Resources.Resources.database_import.GetHicon())
    End Sub

    Private Sub btnOK_Click(sender As System.Object, e As System.EventArgs) Handles btnRealizar.Click
        Me.Cursor = Cursors.WaitCursor
        Try
            GesMantenimiento.RealizarRestore(txtRuta.Text)
            MessageExt.Show(GesIdiomas.TraduceMensaje("MSGMANT002").ToString())
        Catch ex As Exception
            My.Application.HandlerException(ex)
        End Try
        Me.Cursor = Cursors.Default

        Me.Close()

    End Sub

    Private Sub btnCancel_Click(sender As System.Object, e As System.EventArgs) Handles btnCancelar.Click
        Me.Close()
    End Sub

    Private Sub btnExaminar_Click(sender As System.Object, e As System.EventArgs) Handles btnExaminar.Click
        ofdRestore.InitialDirectory = My.Computer.FileSystem.SpecialDirectories.MyDocuments
        ofdRestore.Filter = "Archivos Bak (*.bak)|*.bak|Todos los archivos (*.*)|*.*"
        If (ofdRestore.ShowDialog(Me) = System.Windows.Forms.DialogResult.OK) Then
            Dim FileName As String = ofdRestore.FileName
            txtRuta.Text = FileName
            txtRuta.Focus()
        End If
    End Sub

End Class